home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / doc / plot03 < prev    next >
Encoding:
Text File  |  1997-07-08  |  509 b   |  25 lines

  1. ; This batch file creates a plot used in Chapter 10, "Plotting",
  2. ; of _Using IDL_.
  3.  
  4. ; Define variables.
  5.  
  6. @plot01
  7.  
  8. ; Use the LINFIT function to fit the data to a line.
  9.  
  10. COEFF = LINFIT(YEAR, SOCKEYE)
  11.  
  12. ; YFIT is the fitted line.
  13.  
  14. YFIT = coeff(0) + coeff(1)*YEAR
  15.  
  16. ;Plot the original data points with PSYM = 4, for diamonds.
  17.  
  18. PLOT, YEAR, SOCKEYE, /YNOZERO, PSYM = 4, $
  19.     TITLE = 'Linear Fit', XTITLE = 'Year', $
  20.     YTITLE = 'Fish (thousands)'    
  21.  
  22. ;Overplot the smooth curve using a plain line.
  23.  
  24. OPLOT, YEAR, YFIT
  25.